<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/10/10 0010
 * Time: 下午 10:43
 */


class person
{
    private $name;
    private $sex;
    private $age;

    function getName()
    {
        return $this->name;
    }

    function setName($name)
    {
        $this->name = $name;
    }

    function getSex()
    {
        return $this->sex;
    }

    function setSex($sex)
    {
        $this->sex = $sex;
    }

    function getAge()
    {
        return $this->age;
    }

    function setAge($age)
    {
        $this->age = $age;
    }
}

$person = new person();

$reflect = new ReflectionObject($person);
$props = $reflect->getProperties();
foreach ($props as $prop) echo $prop->getName() . '<br/>';

$m = $reflect->getMethods();
foreach ($m as $prop) echo $prop->getName() . '<br/>';

var_dump(get_object_vars($person), get_class_vars(get_class($person)), get_class_methods(get_class($person)));